export default <T = any>(customTable?: Ref<TableRef>) => {
    const tableRef = ref<TableRef>();

    const searchParams = ref<T>();

    const search = (e: T) => {
        searchParams.value = e;
        if (customTable?.value) {
            customTable.value.getData?.(searchParams.value as anyObj);
            customTable.value.getCellAddData();
        } else {
            tableRef.value?.getData?.(searchParams.value as anyObj);
            tableRef.value?.getCellAddData();
        }
    };

    return { search, params: searchParams, tableRef };
};
